<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    $router->get('demo',function(){});
});
$router->post('login','CommonController@login');
$router->post('download','CommonController@download');//下载图片demo
$router->get('demo','CommonController@download');


$router->group(['middleware' => 'adminOuth'], function () use ($router) {
    
    $router->post('loginOut','CommonController@loginOut');
    $router->post('getUserInfo','CommonController@getUserInfo');//获取后台用户信息
    $router->post('article/lists','ArticleController@lists');//文章列表
    $router->post('article/add','ArticleController@add');//文章新增


    //权限管理
    $router->group(['prefix'=>'auth'],function($router){
        //添加用户
        $router->post('user/list','UserController@list');
        $router->post('user/add','UserController@add');
        $router->post('user/edit','UserController@edit');
        $router->post('user/update','UserController@update');
        $router->post('user/delete','UserController@delete');
        $router->post('user/userRoleList','UserController@userRoleList');//用户获取所属角色列表
        $router->post('user/userRoleUpdate','UserController@userRoleUpdate');//用户更新所属角色
        //添加角色
        $router->post('role/list','RoleController@list');
        $router->post('role/add','RoleController@add');
        $router->post('role/edit','RoleController@edit');
        $router->post('role/update','RoleController@update');
        $router->post('role/delete','RoleController@delete');
        //添加权限
        $router->post('permission/listTree','PermissionController@listTree');
        $router->post('permission/list','PermissionController@list');
        $router->post('permission/add','PermissionController@add');
        $router->post('permission/edit','PermissionController@edit');
        $router->post('permission/update','PermissionController@update');
        $router->post('permission/delete','PermissionController@delete');
        $router->post('permission/getFirst','PermissionController@getFirst');

        //分配权限
        $router->post('assign/save','AssignController@save');
        $router->post('assign/list','AssignController@list');


        


        $router->post('role/getMenuByRole','RoleController@getMenuByRole');//获取角色的所有权限
        $router->post('role/saveRoleMenu','RoleController@saveRoleMenu');//保存角色权限

    });
    
});